#include <cstring>
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>

#define x first
#define y second
#define MAX(a,b,c) max(max(a, b),c)
#define MIN(a,b,c) min(min(a, b),c)
#define debug(x) cout<<#x<<":"<<x<<endl;
#define endl '\n'

using namespace std;

typedef long long ll; 
typedef pair<int, int> PII;

const int N = 50 + 10, mod = 1e9 + 7;

int n, m, t, k;

int s[N], dp[N], f[N];
char g[N][N];

string str;

vector<int> vec;

void solve()
{
	cin >> n >> str;
	for (int i = 0; i < str.size(); i++)
		for (int j = 0; j < str.size(); j++)
			g[i][j] = ' ';
	for (int i = 0; i < str.size(); i++)
		for (int j = 0; j < str.size(); j++)
			if (i == j) g[i][j] = 'X';
			else if (str[i] == '1') g[i][j] = g[j][i] = '=';
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == '1') continue;
		int flag = 1;
		for (int j = 0; j < str.size(); j++)
		{
			if (i == j) continue;
			if (g[i][j] == ' ')
			{
				flag = 0;
				g[i][j] = '+';
				g[j][i] = '-';
				break;
			}
		}
		if (flag)
		{
			puts("NO");
			return;
		}
	}
	puts("YES");
	for (int i = 0; i < str.size(); i++)
	{
		for (int j = 0; j < str.size(); j++)
		{
			if (g[i][j] == ' ') g[i][j] = '=';
			printf("%c", g[i][j]);
		}puts("");
	}
}

int main()
{
    t = 1;
    cin >> t;
    while(t--) 
        solve();
    return 0;
}
